<?php
class Model_Admin_News extends Model{

    public function getInfo($username,$caption,$offset,$pageSize){

        $sql="select count(1)total
             from news t
             where t.isdeleted<>'1'";

        $total=DB::query(Database::SELECT,$sql)->execute()->get("total");

        $sql="select t.newsid id,t.title,t.description,t.link,t.createdon
             from news t
             where t.isdeleted<>'1'
             order by t.createdon desc limit $offset,$pageSize";

        $data=DB::query(Database::SELECT,$sql)->execute()->as_array();

        return array("total"=>$total,"list"=>$data);
    }
}